﻿Public Class RedificioManz

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal idProyecto As Int32, ByVal idEtapa As Int32) As List(Of EedificioManz)
        Dim edificios As List(Of EedificioManz) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                edificios = DedificioManz.SeleccionarTodo(descEmpresa, idProyecto, idEtapa)
                If edificios Is Nothing Then edificios = New List(Of EedificioManz)
                If DisplaySelect Then edificios.Insert(0, New EedificioManz("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return edificios
    End Function
    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean, ByVal idProyecto As Int32, ByVal idEtapa As Int32, _
                                           ByVal idTpoConstruccion As Int32) As List(Of EedificioManz)
        Dim edificios As List(Of EedificioManz) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                edificios = DedificioManz.SeleccionarTodo(descEmpresa, idProyecto, idEtapa, idTpoConstruccion)
                If edificios Is Nothing Then edificios = New List(Of EedificioManz)
                If DisplaySelect Then edificios.Insert(0, New EedificioManz("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return edificios
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal pEdificioManz As EedificioManz) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DedificioManz.Añadir(descEmpresa, pEdificioManz)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal pEdificioManz As EedificioManz) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DedificioManz.Editar(descEmpresa, pEdificioManz)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Eliminar(ByVal descEmpresa As String, ByVal pEdificioManz As EedificioManz) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DedificioManz.Eliminar(descEmpresa, pEdificioManz)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
